import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Message {
    private String address;
    private int port;
    private String name;
    private String msg;
    private String date;

    @Override
    public String toString() {
        return "Message{" +
                "address='" + address + '\'' +
                ", port=" + port +
                ", name='" + name + '\'' +
                ", msg='" + msg + '\'' +
                ", date=" + date +
                '}';
    }

    public Message() {
    }

    public Message(String name, String msg, Date date) {
        DateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        this.date = dateFormat.format(date);
        this.name = name;
        this.msg = msg;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public String getDate() {
        return date;
    }

    public void setDate(Date date) {
        DateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        this.date = dateFormat.format(date);
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }
}
